$(function() {

	$.ajax({
		url: 'https://newapp.icandrive.cn/api/checkorder.php',
		type: 'post',
		dataType: 'json',
		data: {
			token: token
		},
		success: function(data) {




			if(data.status == 200) {
				$(data.dataing).each(function() {

					 localStorage.songteacher_id=this.teacher_id;
					 localStorage.songphone=this.phone;
					 localStorage.songteacher_name=this.teacher_name;


					$('.main').append("<div class='coach' >" +
						"<div class='pic'>" +
						"<img src='" + this.teacher_photo + "' alt='教练图片'>" +
						"</div>" +
						"<div class='message'>" +
						"<h4>" + this.teacher_name + "</h4>" +
						"<p></p>" +
						"<span><i>暂无送考</i><i>距2.4km</i></span>" +
						"</div>" +
						"</div>");
						$(".coach").click(function(){
                        window.location.href='../Send_test/Send_test.html'});
				})

			} else if(data.status == 300){
				layer.msg('还未约教');
			}
			else {
				layer.msg('系统繁忙');
			}
		},
		error: function() {
			layer.msg('系统繁忙', function() {
				history.go(0)
			}, 2000);
		}
	})

});

var token = localStorage.phone;

$('.back').click(function() {
	history.back(0);
})


$(".news span").click(function() {
	$(".news").hide()
})

/*监听手机返回按键*/
document.addEventListener("plusready", function() {
	// 注册返回按键事件
	plus.key.addEventListener('backbutton', function() {
		window.history.back();
	}, false);
	//此处false代表不退出页面，如果为true回退到上一个一面
});
